<!doctype html>
<html lang="en" class="fixed">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>选择课程</title>
    <link rel="apple-touch-icon" sizes="120x120" href="favicon/apple-icon-120x120.png">
    <link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png">
    <link rel="stylesheet" type="text/css"
          href="<?php xcho(loadSource('/assets/plugins/bootstrap/css/bootstrap.min.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/animate.css/animate.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/font-awesome/css/font-awesome.css')) ?>">
    <link rel="stylesheet"
          href="<?php xcho(loadSource('/assets/plugins/data-table/media/css/dataTables.bootstrap.min.css')) ?>">
<!--    <link rel="stylesheet" href="--><?php //xcho(loadSource('/assets/plugins/ztree/css/zTreeStyle/zTreeStyle.css')) ?><!--">-->
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/layui/css/layui.css')) ?>" media="all">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/ztree/css/metroStyle/metroStyle.css')) ?>" type="text/css">
    <link rel="stylesheet" href="<?php xcho(loadSource('/app/css/style.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/app/css/app.css')) ?>">
    
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/css/new_main.css')) ?>">
    
    <style>
        *{
            margin: :0;
            padding: 0;
            box-sizing: border-box;
        }
        ul,li,ol,li{
            list-style: none;
        }
        body{
            background: #f4f4f4;
        }
        .course-content-title{
            width: 1200px;
            padding: 10px 20px;
            background: #fff;
            margin: 0 auto;
        }
        .course-content-title h2{
            font-size: 18px;
            padding-bottom: 10px;
            border-bottom: 1px #ccc solid;
        }
        .course-content-title .range{
            margin-top: 10px;
        }
        .course-content-title .range .layui-form-item label{
            font-size: 12px;
            padding: 6px;
            background: #FBFBFB;
            border: 1px #E8E8E8 solid;
            margin-left: 8px;
            width: initial;
        }
        .course-content-title .range select{
            width: 80px;
            border: 1px #ccc solid;
            font-size: 10px;
            color:#333;
        }
        .course-content-title .range select option{
            font-size: 10px;
        }
        .course-content-title .range input{
            width: 110px;
            height: 34px;
            border: none;
            font-size: 12px;
            border:1px #ccc solid;
            border-left: none;
            text-indent: 6px;
        }
        .course-content-title .range div{
            display: inline-block;
            margin-bottom: 0;
        }
        .course-content-title .canal{
            margin-top: 5px;
        }
        .course-content-title .next input{
            width: 240px;
            height: 30px;
            border-radius: 6px;
            border: none;
            border: 1px #ccc solid;
            outline: none;
            font-size: 10px;
            text-indent: 10px;
        }
        .course-content-cont{
            width: 1200px;
            padding: 20px 20px 30px;
            background: #fff;
            margin: 30px auto;
        }
        .course-content-cont .top_pages{
            padding: 3px 15px;
            height: 30px;
            margin-top: 8px;
            font-size: 0;
        }
        .course-content-cont .top_pages p{
            display: inline-block;
            font-size: 12px;
        }
        .course-content-cont .top_pages ul{
            font-size: 0;
            display: inline-block;
            float: right;
        }
        .course-content-cont .top_pages ul li:nth-of-type(1){
            border:none;
            background: none;
        }
        .course-content-cont .top_pages ul li:nth-of-type(1):hover{
            background: none;
            color:#999;
        }
        .course-content-cont .top_pages ul li{
            display: inline-block;
            font-size: 12px;
            background: #fff;
            margin-left: 10px;
            line-height: 24px;
            text-align: center;
            border-radius: 6px;
            cursor: pointer;
            color:#999;
        }
        .course-content-cont .top_pages ul li:last-child{
            border:none;
            background: none;
        }
        .course-content-cont .top_pages ul li:last-child input{
            width: 50px;
            margin: 0 10px;
            border-radius: 6px;
            border: none;
            border:1px #ccc solid;
            outline: none;
        }
        .course-content-cont .top_pages ul li:last-child:hover{
            background: none;
            color:#999;
        }
        .course-content-cont .top_pages ul li:hover{
            background: #108EE9;
            color:#fff;
        }
        .course-content-cont .table{
            width: 100%;
            margin-top: 10px;
        }
        .course-content-cont .table table{
            width: 100%;
        }
        .course-content-cont .table table thead tr th{
            padding: 10px;
            background: #f2f2f2;
            color:#000;
            font-weight: normal;
            border:1px #e2e2e2 solid;
            text-align: center;
        }
        .course-content-cont .table table tbody tr:hover{
            background: #f2f2f2;
        }
        .course-content-cont .table table tbody tr td{
            padding: 8px;
            border-bottom: 1px #eee solid;
            text-align: center;
        }
        .course-content-cont .bottom_pages{
            padding: 3px 15px;
            height: 30px;
            margin-top: 8px;
            background: #fff;
            font-size: 0;
        }
    </style>
</head>

<body><?php include_once TPL_PATH . 'public/nav.phtml'; ?>
<div class="course-content" style="margin: 0;background: #ececec">
    <div class="course-content-title">
        <h2>选择课程</h2>
        <form id="courseList" action="">
            <div class="layui-form range">
                <div class="layui-form-item">
                    <label class="layui-form-label">科目：</label>
                    <select name="csubject" id="csubject">
                        <option value="">全部</option>
                        <?php foreach ($aSubject as $aTmp) { ?>
                            <option value="<?php xcho($aTmp['dict_value']) ?>"
                                <?php if ($aTmp['dict_value'] == $aSearch['csubject']) { ?>
                                    selected="selected"
                                <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                        <?php } ?>
                    </select>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">教材版本：</label>
                    <select name="edition" id="edition">
                        <option value="">全部</option>
                        <?php foreach ($aEdition as $aTmp) { ?>
                            <option value="<?php xcho($aTmp['dict_value']) ?>"
                                <?php if ($aTmp['dict_value'] == $aSearch['edition']) { ?>
                                    selected="selected"
                                <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                        <?php } ?>
                    </select>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">年级：</label>
                    <select name="grade" id="grade">
                        <option value="">全部</option>
                        <?php foreach ($aGrade as $aTmp) { ?>
                            <option value="<?php xcho($aTmp['dict_value']) ?>"
                                <?php if ($aTmp['dict_value'] == $aSearch['grade']) { ?>
                                    selected="selected"
                                <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                        <?php } ?>
                    </select>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">课程年份：</label>
                    <select name="cyear" id="cyear">
                        <option value="">全部</option>
                        <?php foreach ($aYear as $aTmp) { ?>
                            <option value="<?php xcho($aTmp['dict_value']) ?>"
                                <?php if ($aTmp['dict_value'] == $aSearch['cyear']) { ?>
                                    selected="selected"
                                <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                        <?php } ?>
                    </select>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">课程周期：</label>
                    <select name="season" id="season">
                        <option value="">全部</option>
                        <?php foreach ($aSeasonType as $aTmp) { ?>
                            <option value="<?php xcho($aTmp['dict_value']) ?>"
                                <?php if ($aTmp['dict_value'] == $aSearch['season']) { ?>
                                    selected="selected"
                                <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                        <?php } ?>
                    </select>
                </div>
            </div>
            <div class="layui-form range next">
                <div class="layui-form-item">
                    <label class="layui-form-label">搜索：</label>
                    <input type="text" id="keyword" name="keyword" value="<?php xcho($aSearch['keyword'])?>" placeholder="可搜课程名称">
                    <input type="hidden" id="searchFor" name="searchFor" value="Course">
                    <input type="hidden" id="countType" name="countType" value="many">
                    <input type="hidden" id="signup_status" name="signup_status" value="<?php xcho($sSignupStatus)?>">
                    <input type="hidden" id="ctype" name="ctype" value="<?php xcho($aSearch['ctype'])?>">
                    <input type="hidden" id="sPId" name="sPId" value="<?php xcho($sPId)?>">
                    <input type="hidden" id="sPName" name="sPName" value="<?php xcho($sPName)?>">
                    <input type="hidden" id="ctype" name="ctype" value="<?php xcho($aSearch['ctype'])?>">
                </div>
                <button id="search" data-url="<?php xcho($sSearchAction) ?>" class="layui-btn layui-btn-small">
                    <i class="layui-icon">&#xe615;</i>
                </button>
            </div>
        </form>
    </div>
    <div class="course-content-cont">
        <div class="top_pages">
            <ul>
                <?php xchoHtml($aOrderCourse->render()) ?>
            </ul>
        </div>
        <div class="table">
            <table>
                <thead>
                <tr>
                    <th><input type="checkbox" id="checkAll" name="checkAll" lay-skin="primary"></th>
                    <th>课程名称</th>
                    <th>课目</th>
                    <th>年级</th>
                    <th>教材版本</th>
                    <th>课程周期</th>
                    <th>课程年份</th>
                    <th>价格</th>
                    <th>总小时</th>
                    <th>官网课程名</th>
                    <th>课程后台ID</th>
                    <th>官网课程ID</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($aOrderCourse as $aKey) { ?>
                    <?php foreach ($aOCourse as $aCourse) { ?>
                        <?php if ($aCourse['id'] == $aKey['id']) { ?>
                            <tr>
                                <td><input type="checkbox" name="ck" lay-skin="primary" id="<?php xcho($aCourse['id']) ?>"></td>
                                <td><a href="<?php xcho($aCourse['view_url']) ?>"><?php xcho($aCourse['cname']) ?></a></td>
                                <td><?php xcho($aCourse['csubject_str']) ?></td>
                                <td>
                                    <?php foreach ($aCourse['grade_str'] as $aTmp) { ?>
                                        <?php xcho($aTmp) ?>
                                    <?php } ?>
                                </td>
                                <td>
                                    <?php foreach ($aCourse['edition_str'] as $aTmp) { ?>
                                        <?php xcho($aTmp) ?>
                                    <?php } ?>
                                </td>
                                <td>
                                    <?php foreach ($aCourse['season_str'] as $aTmp) { ?>
                                        <?php xcho($aTmp) ?>
                                    <?php } ?>
                                </td>
                                <td>
                                    <?php foreach ($aCourse['cyear'] as $aTmp) { ?>
                                        <?php xcho($aTmp) ?>
                                    <?php } ?>
                                </td>
                                <td><?php xcho($aCourse['price']) ?></td>
                                <td><?php xcho($aCourse['duration']) ?></td>
                                <td><?php xcho($aCourse['gw_name']) ?></td>
                                <td><?php xcho($aCourse['ht_id']) ?></td>
                                <td><?php xcho($aCourse['gw_id']) ?></td>
                            </tr>
                        <?php } ?>
                    <?php } ?>
                <?php } ?>
                </tbody>
            </table>
        </div>
        <div class="top_pages bottom_pages">
            <ul>
                <?php xchoHtml($aOrderCourse->render()) ?>
            </ul>
        </div>
    </div>
</div>
</div>
<script src="<?php xcho(loadSource('/assets/plugins/jquery/jquery.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/layui/layui.all.js')) ?>" charset="utf-8"></script>
<script src="<?php xcho(loadSource('/assets/plugins/bootstrap/js/bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/data-table/media/js/jquery.dataTables.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/data-table/media/js/dataTables.bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/layer-v3.0.3/layer/layer.js')) ?>"></script>
<script
    src="<?php xcho(loadSource('/assets/plugins/data-table/extensions/Responsive/js/dataTables.responsive.min.js')) ?>"></script>
<script
    src="<?php xcho(loadSource('/assets/plugins/data-table/extensions/Responsive/js/responsive.bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.core.js')) ?>"></script>
<script type="text/javascript" src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.excheck.js')) ?>"></script>
<script type="text/javascript" src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.exedit.js')) ?>"></script>
<script>
    $(function () {
        $("#checkAll").click(function() {
            $("input[name='ck']").each(function(){
                if($(this).prop("checked"))
                {
                    $(this).prop("checked",false);
                }
                else
                {
                    $(this).prop("checked","true");
                }
            })
        });
        $(".top_more").hover(function(){
            $(this).find("ul").show();
        },function(){
            $(this).find("ul").hide();
        })
        $("table tr>td>span").hover(function(){
            $(this).find("b").show();
        },function(){
            $(this).find("b").hide();
        });

        //搜索-form表单提交
        $("#search").click(function () {
            $("#courseList").submit();
        })

    });
    //选择课程
    function selectCourse() {
        var sum_price = window.parent.document.getElementById('original_price');
        var real_price = window.parent.document.getElementById('real_price');
        var oTrList = '';
        $("input[name='ck']:checked").each(function(){
            $(sum_price).text(parseFloat($(sum_price).text())+parseFloat($(this).parent().siblings().eq(6).text()));
            $(real_price).text(parseFloat($(real_price).text())+parseFloat($(this).parent().siblings().eq(6).text()));
            oTrList += "<tr>"
                    +"<td name='course_name' course-id='"+$(this).attr('id')+"'>"+$(this).parent('td').next('td').html()
                    +"</td><td name='original_average_price'>"
                    +($(this).parent().siblings().eq(6).text()/$(this).parent().siblings().eq(7).text()).toFixed(2)
                    +"</td><td name='original_duration'>"+parseFloat($(this).parent().siblings().eq(7).text()).toFixed(2)
                    +"</td><td name='original_price'>"+parseFloat($(this).parent().siblings().eq(6).text()).toFixed(2)
                    +"</td><td name='real_average_price'>"
                    +($(this).parent().siblings().eq(6).text()/$(this).parent().siblings().eq(7).text()).toFixed(2)
                    +"</td><td name='real_duration'><input type='text' class='input_change' value='"+parseFloat($(this).parent().siblings().eq(7).text()).toFixed(2)+"'>"
                    +"</td><td name='real_price'><input type='text' class='input_change' value='"+parseFloat($(this).parent().siblings().eq(6).text()).toFixed(2)+"'>"
                    +"</td><td><a class='glyphicon glyphicon-trash delte-tr'></a></td></tr>";
        })
        return oTrList;
    }
</script>
<?php include_once TPL_PATH . 'public/foot_script.phtml'; ?>
<button id="top" style="height: 50px;width: 50px;"></button></body>

</html>
